using System.Data;
using ET;
namespace DA
{
	public class Transaction_DAL
	{
	private clsConnect cls = new clsConnect();

	#region Getdata
	public DataTable BindGirdtb_Transaction(string keywords)
	{
	return cls.Search("sp_tb_Transaction_Search", "@KeyWords", keywords);
	}
    public DataTable BindGirdtb_TransactionDetail(int id)
    {
        return cls.GetData_ID_Int("sp_tb_Transaction_Detail", "@Transaction_ID", id);
    }
	#endregion

	#region Insert
	public bool Inserttb_Transaction(Transaction_ET data)
	{
	cls.CreateNewSqlCommand();
	cls.AddParameter("@Transaction_No", data.Transaction_No);
	cls.AddParameter("@Transaction_Date", data.Transaction_Date);
	cls.AddParameter("@Transaction_ID_Before", data.Transaction_ID_Before);
	cls.AddParameter("@Customer_ID", data.Customer_ID);
	cls.AddParameter("@Method_ID", data.Method_ID);
	cls.AddParameter("@Destination_ID", data.Destination_ID);
	cls.AddParameter("@Transaction_Content", data.Transaction_Content);
    cls.AddParameter("@Transaction_Result", data.Transaction_Result);
	cls.AddParameter("@Transaction_Note", data.Transaction_Note);
	cls.AddParameter("@Transaction_Available", data.Transaction_Available);
	cls.AddParameter("@Transaction_Available_Content", data.Transaction_Available_Content);
	cls.AddParameter("@Transaction_NotAvailable", data.Transaction_NotAvailable);
	cls.AddParameter("@Transaction_NotAvailable_Content", data.Transaction_NotAvailable_Content);
	cls.AddParameter("@Transaction_Contact_Again", data.Transaction_Contact_Again);
	cls.AddParameter("@Transaction_Contact_Again_Content", data.Transaction_Contact_Again_Content);
	cls.AddParameter("@Transaction_Schedule", data.Transaction_Schedule);
	cls.AddParameter("@Transaction_Schedule_ID", data.Transaction_Schedule_ID);
	cls.AddParameter("@Transaction_Potential", data.Transaction_Potential);
	cls.AddParameter("@Transaction_NotPotential", data.Transaction_NotPotential);
	cls.AddParameter("@Transaction_Unknown", data.Transaction_Unknown);
	cls.AddParameter("@Transaction_User_Add", data.Transaction_User_Add);
	cls.AddParameter("@Transaction_Date_Add", data.Transaction_Date_Add);
	cls.AddParameter("@Transaction_Computer_Add", data.Transaction_Computer_Add);
	cls.AddParameter("@Transaction_User_Modify", data.Transaction_User_Modify);
	cls.AddParameter("@Transaction_Date_Modify", data.Transaction_Date_Modify);
	cls.AddParameter("@Transaction_Computer_Modify", data.Transaction_Computer_Modify);
	cls.ExecuteNonQuery("sp_tb_Transaction_Insert");
	return true;
	}
	#endregion

	#region Update
	public bool Updatetb_Transaction(Transaction_ET data)
	{
	cls.CreateNewSqlCommand();
	cls.AddParameter("@Transaction_ID", data.Transaction_ID);
	cls.AddParameter("@Transaction_No", data.Transaction_No);
	cls.AddParameter("@Transaction_Date", data.Transaction_Date);
	cls.AddParameter("@Transaction_ID_Before", data.Transaction_ID_Before);
	cls.AddParameter("@Customer_ID", data.Customer_ID);
	cls.AddParameter("@Method_ID", data.Method_ID);
	cls.AddParameter("@Destination_ID", data.Destination_ID);
	cls.AddParameter("@Transaction_Content", data.Transaction_Content);
    cls.AddParameter("@Transaction_Result", data.Transaction_Result);
	cls.AddParameter("@Transaction_Note", data.Transaction_Note);
	cls.AddParameter("@Transaction_Available", data.Transaction_Available);
	cls.AddParameter("@Transaction_Available_Content", data.Transaction_Available_Content);
	cls.AddParameter("@Transaction_NotAvailable", data.Transaction_NotAvailable);
	cls.AddParameter("@Transaction_NotAvailable_Content", data.Transaction_NotAvailable_Content);
	cls.AddParameter("@Transaction_Contact_Again", data.Transaction_Contact_Again);
	cls.AddParameter("@Transaction_Contact_Again_Content", data.Transaction_Contact_Again_Content);
	cls.AddParameter("@Transaction_Schedule", data.Transaction_Schedule);
	cls.AddParameter("@Transaction_Schedule_ID", data.Transaction_Schedule_ID);
	cls.AddParameter("@Transaction_Potential", data.Transaction_Potential);
	cls.AddParameter("@Transaction_NotPotential", data.Transaction_NotPotential);
	cls.AddParameter("@Transaction_Unknown", data.Transaction_Unknown);
	cls.AddParameter("@Transaction_User_Add", data.Transaction_User_Add);
	cls.AddParameter("@Transaction_Date_Add", data.Transaction_Date_Add);
	cls.AddParameter("@Transaction_Computer_Add", data.Transaction_Computer_Add);
	cls.AddParameter("@Transaction_User_Modify", data.Transaction_User_Modify);
	cls.AddParameter("@Transaction_Date_Modify", data.Transaction_Date_Modify);
	cls.AddParameter("@Transaction_Computer_Modify", data.Transaction_Computer_Modify);
	cls.ExecuteNonQuery("sp_tb_Transaction_Update");
	return true;
	}
	#endregion

	#region Delete
	public bool Deletetb_Transaction(int id)
	{
        cls.Delete("sp_tb_Transaction_Delete", "@Transaction_ID", id);
	return true;
	}
	#endregion
	}
}